/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2016-5-6         yellowlgx
 */

package com.skyworth.ui.api;

import android.os.SystemProperties;
import android.text.TextUtils;

import com.skyworth.commen.ui.R;

/**
 * @author yellowlgx
 * @version TODO (write something)
 * @ClassName SkyDefualtBgView
 * @Description TODO (write something)
 * @date 2016-5-6
 */
public class SkyLogo
{

    private static SkyLogo mLogo;
    private String pe = null;
    private boolean isOversea = false;

    // 单例初始化
    public static SkyLogo getInstence()
    {
        if (mLogo == null)
        {
            mLogo = new SkyLogo();
        }
        return mLogo;
    }

    public SkyLogo()
    {
        pe = getProperty("ro.build.PE");
        isOversea = isOverseasProduct();
    }

    public String getProperty(String key)
    {
        return SystemProperties.get(key);
    }

    /**
     * 是否是海外产品，某些功能针对海外产品会有差异
     *
     * @return
     */
    public boolean isOverseasProduct()
    {
        return !TextUtils.isEmpty(getProperty("third.get.test.pid")) || !TextUtils.isEmpty(getProperty("ro" +
                ".build.PID.index"));
    }

    public int getLogoRes(boolean isLogo)
    {
        if (TextUtils.isEmpty(pe))
        {
            if (isOversea)
            {
                if (isLogo)
                {
                    return R.drawable.coocaa_logo_pe;
                } else
                {
                    return R.drawable.coocaa_logo_bg_pe;
                }
            } else
            {
                if (isLogo)
                {
                    return R.drawable.coocaa_logo;
                } else
                {
                    return R.drawable.coocaa_logo_bg;
                }
            }
        } else
        {
            if (isLogo)
            {
                return R.drawable.coocaa_logo_pe;
            } else
            {
                return R.drawable.coocaa_logo_bg_pe;
            }
        }
    }

}
